home *** CD-ROM | disk | FTP | other *** search
- class Map extends MovieClip
- {
- var map;
- var player;
- var ia;
- var shad;
- var scale;
- var dx;
- var dy;
- function Map()
- {
- super();
- this.createEmptyMovieClip("map",this.getNextHighestDepth());
- this.map.cacheAsBitmap = true;
- var _loc3_ = this.createEmptyMovieClip("player",this.getNextHighestDepth());
- }
- function initPlayer()
- {
- this.player.lineStyle(2,255,100,false,"none");
- this.player.beginFill(255,100);
- this.player.moveTo(0,-2);
- this.player.lineTo(6,0);
- this.player.lineTo(0,2);
- this.player.lineTo(0,-2);
- this.player.endFill();
- this.player._rotation = this.ia * Trig.rd;
- }
- function drawTrack(track, sx, sy, size)
- {
- if(this.shad)
- {
- var _loc4_ = this.map.getDepth();
- this.map.removeMovieClip();
- this.createEmptyMovieClip("map",_loc4_);
- this.shad.removeMovieClip();
- delete this.scale;
- delete this.dx;
- delete this.dy;
- this._x = 0;
- this._y = 0;
- this._xscale = 100;
- this._yscale = 100;
- this.player._xscale = 100;
- this.player._yscale = 100;
- this.player._x = 0;
- this.player._y = 0;
- }
- var _loc9_ = track[0].x;
- var _loc8_ = track[0].y;
- this.map.lineStyle(2,16777215,100,false,"none");
- this.map.moveTo(track[0].x,track[0].y);
- this.ia = track[0].a;
- var _loc2_ = 0;
- while(_loc2_ < track.length)
- {
- if(track[_loc2_].s)
- {
- _loc9_ += track[_loc2_].l * Math.cos(track[_loc2_].a);
- _loc8_ += track[_loc2_].l * Math.sin(track[_loc2_].a);
- this.map.lineTo(_loc9_,_loc8_);
- }
- else
- {
- _loc4_ = track[_loc2_].d;
- var _loc5_ = track[_loc2_].a + Trig.ra * _loc4_;
- _loc5_ = 0;
- while(_loc5_ <= track[_loc2_].c)
- {
- var _loc7_ = track[_loc2_].cx + track[_loc2_].r * Math.cos(_loc5_ * _loc4_ + track[_loc2_].a - Trig.ra * _loc4_);
- var _loc6_ = track[_loc2_].cy + track[_loc2_].r * Math.sin(_loc5_ * _loc4_ + track[_loc2_].a - Trig.ra * _loc4_);
- this.map.lineTo(_loc7_,_loc6_);
- _loc5_ += 0.05;
- }
- _loc9_ = track[_loc2_].cx + track[_loc2_].r * Math.cos(track[_loc2_].c * _loc4_ + track[_loc2_].a - Trig.ra * _loc4_);
- _loc8_ = track[_loc2_].cy + track[_loc2_].r * Math.sin(track[_loc2_].c * _loc4_ + track[_loc2_].a - Trig.ra * _loc4_);
- this.map.lineTo(_loc9_,_loc8_);
- }
- _loc2_ = _loc2_ + 1;
- }
- this.scale = size / (this._width <= this._height ? this._height : this._width);
- this._xscale *= this.scale;
- this._yscale *= this.scale;
- this.player._xscale /= this.scale;
- this.player._yscale /= this.scale;
- var _loc10_ = this.getBounds(this._parent);
- this.dx = _loc10_.xMin - sx;
- this.dy = _loc10_.yMin - sy;
- this._x -= this.dx;
- this._y -= this.dy;
- this.map.duplicateMovieClip("shad",this.getNextHighestDepth());
- this.player.swapDepths(this.shad);
- this.map.swapDepths(this.shad);
- this.shad._x = 1 / this.scale;
- this.shad._y = 1 / this.scale;
- var _loc11_ = new Color(this.shad);
- _loc11_.setTransform({ra:100,rb:-255,ga:100,gb:-168,ba:100,bb:-131,aa:100,ab:0});
- }
- function drawPlayer(p, a)
- {
- var _loc2_ = new Vector(p.x * this.scale - this.dx,p.y * this.scale - this.dy);
- this.globalToLocal(_loc2_);
- this.player._x = _loc2_.x;
- this.player._y = _loc2_.y;
- this.player._rotation = a * Trig.rd;
- }
- }
-